package com.example.wechat;

import java.sql.Connection;
import java.sql.DriverManager;

public class MySQLConnection {
    //jdbc:mysql://logic-dw-pub.proxy.dms.aliyuncs.com:3306/?user=EdoXcpsvNDm2WCEmE0XgDh1u&password=m2rCRuHrwY3kDdXAX5bALyKwaYsOYj
    //mysql -hdphzmy-tteofx4xtbbpqpor-pub.proxy.dms.aliyuncs.com -P3306 -u<认证信息 AccessID> -p<认证信息 AccessSecret> <数据库名(可选)> -e 'SHOW DATABASES'
    private static final String DB_URL = "jdbc:mysql://dphzmy-tteofx4xtbbpqpor-pub.proxy.dms.aliyuncs.com/friend_adapter" +
            "?useSSL=true&serverTimezone=Asia/Shanghai&characterEncoding=utf-8";
    private static final String USER = "xtmG4rfJ9cVw3UaVs0rW9WDo";
    private static final String PASSWORD = "o0VX5aeaAOtZDrAhGb1fP3zpPo6aXi";

    public static Connection getConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver"); // 更新驱动类
            return DriverManager.getConnection(DB_URL, USER, PASSWORD);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}